<script type="text/javascript">
	var data = <?php echo $chart_data;?>; //{minimo:'',maximo:'',nsamples:'',data:[[x1,y1],[x2,y2],...,[xn,yn]]}
			
	$j(document).ready(function () {
		$j('.infiniteCarousel').infiniteCarousel();

		var settings = new ChartSettings();
		settings.init('chartdiv',data);
		settings.setResetID('#btnResetZoom');
		settings.setChartTitle('Segmento');
		settings.setXAxisLabel('Muestras x ms');
		settings.setYAxisLabel('Amplitud [%]');
				
		var mainSeries = new Series();
		mainSeries.init("selected_segment",data.data);
		mainSeries.setLabel('Muestra:');
		mainSeries.setMainSeries(true);
		mainSeries.setConf({showMarker:false, label: mainSeries.getLabel()});
		
		ChartControl.init(settings);
		ChartControl.addSeries(mainSeries);
		ChartControl.paint();
	
		$j(".infiniteCarousel .wrapper ul li a").click(function(){
				ChartControl.feedData(this.href);
				return false;
		});  
	});
</script>